<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        ol,
        ul,
        li {
            list-style: none;
        }

        img {
            width: 100%;
            height: 100%;
            display: block;
        }

        .banner {
            width: 600px;
            height: 400px;
            border: 10px solid pink;
            margin: 50px auto;
            position: relative;
        }

        .banner>.imgBox {
            position: relative;
            width: 100%;
            height: 100%;
        }

        .banner>.imgBox>li {
            width: 100%;
            height: 100%;
            position: absolute;
            left: 0;
            top: 0;

            transition: opacity 0.5s linear;

            opacity: 0;

            font-size: 100px;
            font-weight: 700;
            color: #fff;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .banner>.imgBox>li.active {
            opacity: 1;
        }

        .banner>.pointBox {
            width: 100px;
            height: 15px;
            background-color: rgba(0, 0, 0, 0.5);
            position: absolute;
            left: 30px;
            bottom: 30px;
            border-radius: 15px;

            display: flex;
            justify-content: space-evenly;
            align-items: center;
        }

        .banner>.pointBox>li {
            width: 10px;
            height: 10px;
            background-color: #fff;
            border-radius: 50%;
            cursor: pointer;
        }

        .banner>.pointBox>li.active {
            background-color: red;
        }

        .banner:hover>div {
            display: flex;
        }

        .banner>div {
            width: 30px;
            height: 30px;
            display: flex;
            justify-content: center;
            align-items: center;
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            background-color: rgba(0, 0, 0, 0.3);
            color: #fff;
            font-size: 22px;
            cursor: pointer;
            display: none;
        }

        .banner>div:hover {
            background-color: rgba(0, 0, 0, 0.5);
        }

        .banner>div.left {
            left: 0;
            border-radius: 0 15px 15px 0;
        }

        .banner>div.right {
            right: 0;
            border-radius: 15px 0 0 15px;
        }
    </style>
</head>

<body>
    <!-- 结构布局 -->
    <div class="banner" id="banner">
        <ul class="imgBox">
            <li class="active" style="background-color: skyblue">1</li>
            <li style="background-color: purple">2</li>
            <li style="background-color: yellow">3</li>
            <li style="background-color: hotpink">4</li>
            <li style="background-color: orange">5</li>
        </ul>
        <ol class="pointBox"></ol>
        <div class="left">&lt;</div>
        <div class="right">&gt;</div>
    </div>

    <script src="./banner.js"></script>
    <script>
        // 为了实现轮播图
        const b = new Banner('#banner');
        console.log(b);
    </script>
</body>

</html>